﻿//Created by Action Script Viewer - http://www.buraks.com/asv
package Classes.util {
    import flash.display.*;
    import Classes.*;
    import flash.filters.*;
    import Display.*;
    import flash.text.*;
    import L10n.*;

    public class ActionBar extends Sprite {

        protected var m_actionText:TextField;
        protected var m_width:Number;
        protected var m_height:Number;
        public var progress:Number;
        public var showPercent:Boolean;
        public var prefix:String;
        protected var m_bar:DisplayObject;
        protected var m_mask:Sprite;

        public function ActionBar(_arg1:int, _arg2:int, _arg3:String="", _arg4:Boolean=true){
            this.mouseEnabled = (this.mouseChildren = false);
            var _local5:DisplayObject = (new EmbeddedArt.actn_container() as DisplayObject);
            _local5.width = _arg1;
            _local5.height = _arg2;
            this.addChild(_local5);
            this.m_bar = (new EmbeddedArt.actn_bar() as DisplayObject);
            this.m_bar.width = _arg1;
            this.m_bar.height = _arg2;
            this.addChild(this.m_bar);
            this.m_mask = new Sprite();
            this.addChild(this.m_mask);
            this.m_bar.mask = this.m_mask;
            this.m_width = _arg1;
            this.m_height = _arg2;
            this.progress = 0;
            this.prefix = _arg3;
            this.showPercent = _arg4;
            var _local6:Number = TextFieldUtil.getLocaleFontSize(12, 10, null);
            _local6 = LocaleHelper.localSetting.Number_adjust(_local6, 11);
            var _local7:TextFormat = new TextFormat(EmbeddedArt.DEFAULT_FONT_NAME_BOLD, _local6, 0xFFFFFF, true, null, null, null, null, TextFormatAlign.CENTER);
            this.m_actionText = new TextField();
            this.m_actionText.embedFonts = true;
            this.m_actionText.defaultTextFormat = _local7;
            this.m_actionText.setTextFormat(_local7);
            this.m_actionText.x = 7;
            this.m_actionText.y = 2;
            LocaleHelper.localSetting.TextField_adjust(this.m_actionText, {y:3});
            this.m_actionText.width = (this.m_width - (2 * this.m_actionText.x));
            this.m_actionText.filters = [new GlowFilter(0, 1, 1.5, 1.5, 20, BitmapFilterQuality.HIGH)];
            this.addChild(this.m_actionText);
        }
        public function redraw():void{
            var _local1:Number = 6;
            var _local2:Number = 1;
            this.m_mask.graphics.clear();
            this.m_mask.graphics.lineStyle(0, 0, 0);
            this.m_mask.graphics.beginFill(0xAA00);
            this.m_mask.graphics.drawRoundRect((_local2 / 2), (_local2 / 2), ((this.m_width * this.progress) - _local2), (this.m_height - _local2), _local1, _local1);
            this.m_mask.graphics.endFill();
            var _local3:String = this.prefix;
            if (this.showPercent){
                _local3 = (_local3 + ((" " + Math.floor((this.progress * 100))) + "%"));
            };
            if (this.m_actionText.text != _local3){
                this.m_actionText.text = _local3;
            };
        }

    }
}//package Classes.util 
